<?php
/**
 * Created by PhpStorm.
 * User: bzg
 * Date: 2019/11/28
 * Time: 9:09
 */

namespace App\Extend\SysExtend;

use App\Extend\SysExtend\Session\Session;
use EasySwoole\Component\Di;

/**
 * 助手类
 * Class Helper
 * @package App\Extend\SysExtend
 */
class Helper
{
    /**
     * 获取自定义配置项
     * @param string $name
     * @return mixed
     * @throws \Throwable
     */
    public static function config(string  $name)
    {
        return Di::getInstance()->get('extendConfig')->get($name);
    }

    /**
     * 获取当前请求对象
     * @return EasySwoole\Http\Request
     * @throws \Throwable
     */
    public static function request()
    {
        return Di::getInstance()->get('request');
    }

    /**
     * 获取队列管理类
     * @return null
     * @throws \Throwable
     */
    public static function Queue()
    {
        return Di::getInstance()->get('queueManager');
    }

    /**
     * 获取session类
     * @return Session
     */
    public static function session()
    {
        return new Session();
    }
}